Skip to content

Conversation

Copy link

Copilot AI commented Oct 9, 2025

Summary

This PR adds an optional nickname parameter when placing orders. When provided, the burger-webapp dashboard displays the first 10 characters of the nickname instead of the order ID, making it easier for customers to identify their orders.

Changes

Display Behavior

Before: Orders always showed the last 6 characters of the auto-generated order ID with # prefix (e.g., #abcdef)

After: Orders show the first 10 characters of the nickname if provided (e.g., Alice without # prefix), otherwise fall back to the order ID with # prefix (e.g., #abcdef)

Updated Feature

Implementation

Added nickname as an optional field throughout the order lifecycle:

API Layer:

  • Extended Order interface with nickname?: string
  • Updated CreateOrderRequest to accept optional nickname
  • Modified order creation to store nickname when provided
  • Updated OpenAPI specification with complete documentation

Frontend Layer:

  • Added nickname to BurgerOrder interface
  • Updated dashboard rendering logic to prioritize nickname display:
    const displayId = order.nickname ? order.nickname.slice(0, 10) : `#${order.id.slice(-6)}`;
    • Nicknames display without # prefix
    • Order ID fallback displays last 6 chars with # prefix

MCP Layer:

  • Extended place_order tool schema to accept optional nickname parameter
  • Enables AI agents to use nicknames when placing orders

Example Usage

POST /api/orders
Content-Type: application/json

{
  "userId": "user123",
  "nickname": "Alice",
  "items": [
    {
      "burgerId": "1",
      "quantity": 2
    }
  ]
}

Backward Compatibility

Fully backward compatible - The nickname parameter is optional, so all existing code and integrations continue to work without any changes. Orders without nicknames display exactly as before.

Files Changed

  • packages/burger-api/src/order.ts
  • packages/burger-api/src/functions/orders-post.ts
  • packages/burger-api/openapi.yaml
  • packages/burger-api/api.http
  • packages/burger-webapp/src/orders.service.ts
  • packages/burger-webapp/src/components/burger-dashboard.ts
  • packages/burger-mcp/src/tools.ts

Fixes #3

Original prompt

This section details on the original issue you should resolve

<issue_title>Add optional nickname in orders</issue_title>
<issue_description>Add an optional nickname parameter when placing an order and show it (first 8 chars) in the burger-website instead of orderId (first 8 chars) if it's defined.
</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #3

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add optional nickname parameter to orders Add optional nickname parameter to orders Oct 9, 2025
Copilot AI requested a review from sinedied October 9, 2025 08:46
Copilot finished work on behalf of sinedied October 9, 2025 08:46
Copy link
Contributor

@sinedied sinedied left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor tweaks requested.
And display 10 chars instead of 8 when using a nickname.

@sinedied
Copy link
Contributor

sinedied commented Oct 9, 2025

Minor tweaks requested:

  • display 10 chars instead of 8 when using a nickname.
  • when falling back to orderId, it should keep the previous behavior keeping only the last 6 chars preceded by #. No need for # when a nickname is set.
  • in the MCP tool description, make the () comment shorter with (only first 10 chars displayed)

@copilot

Copy link
Author

Copilot AI commented Oct 9, 2025

Minor tweaks requested:

  • display 10 chars instead of 8 when using a nickname.
  • when falling back to orderId, it should keep the previous behavior keeping only the last 6 chars preceded by #. No ne...

All changes implemented in ffab616:

  • Nickname displays 10 chars (was 8)
  • No # prefix for nicknames
  • prefix only when falling back to order ID (last 6 chars)

  • MCP tool description shortened

Updated Feature

Copilot AI requested a review from sinedied October 9, 2025 10:10
Copilot finished work on behalf of sinedied October 9, 2025 10:10
@sinedied sinedied marked this pull request as ready for review October 9, 2025 12:43
@sinedied sinedied changed the title Add optional nickname parameter to orders feat: add optional nickname parameter to orders Oct 9, 2025
@sinedied sinedied merged commit bdb4146 into main Oct 9, 2025
1 of 7 checks passed
@sinedied sinedied deleted the copilot/add-optional-nickname-in-orders branch October 9, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add optional nickname in orders

2 participants